/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     struct ListNode *next;
 * };
 */


struct ListNode* swapPairs(struct ListNode* head)
{
    struct ListNode virtualNode;
    virtualNode.next = head;
    struct ListNode* cur= &virtualNode;
    while(cur->next && cur->next->next)
    {
        struct ListNode* node1 = cur->next;
        struct ListNode* node2 = cur->next->next;
        cur->next = node2;
        node1->next = node2->next;
        node2->next =node1;
        cur = node1;
    }
    return virtualNode.next;
}